home *** CD-ROM | disk | FTP | other *** search
Text File | 1995-06-24 | 2.4 KB | 62 lines | [TEXT/ttxt] |
- // Copyright © 1994 Apple Computer, Inc. All rights reserved
-
- constant kAppSymbol := '|ACME Serial:PIEDTS|; // Asynchronous Connection Manager Example for Serial endpoints
- constant kAppName := "ACME Serial";
-
- constant kMaxAppWidth := 240; // original MP width
- constant kMaxAppHeight := 336; // original MP height
-
- constant kPort_A := 'Main;
- constant kPort_B := 'SerialIR;
-
- constant kRetryMaxCount:= 0; // max number of times MConnect will try again to establish a connection
-
- constant kState_Disconnected := 0; // ready-to-go (default state)
- constant kState_Listen := 1; // preparation for (asynchronous) listen
- constant kState_Listening := 2; // in-process of (asynchronous) listen
- constant kState_Connect := 3; // preparation for (asynchronous) connect
- constant kState_Connecting := 4; // in-process of (asynchronous) connect
- constant kState_Connected := 5; // connected (requires disconnect)
- constant kState_Disconnecting := 6; // in-process of (asynchronous) disconnect
-
- constant kError_EndpointInUse := -666;
-
- constant kMessage_EndpointInUse := "Another application seems to be using the communications port.";
- constant kMessage_Disconnected := "Ready to connect…";
- constant kMessage_Listening := "Waiting for connection...";
- constant kMessage_Connecting := "Connecting...";
- constant kMessage_Connected_A := "Connected to MAIN serial port, awaiting disconnect...";
- constant kMessage_Connected_B := "Connected to INFRA-RED serial port, awaiting disconnect...";
- constant kMessage_Disconnecting := "Disconnecting, please wait...";
- constant kMessage_Retry := "No response... Will try again...";
- constant kMessage_BufferOverrun := "A parity or bit-frame error has occured, or the communication data buffer was overrun and has been reset.";
-
- // the following constants (kDA_StatusFrame, kDA_ActionFunc, kDA_AddDeferredAction)
- // are used to implement "killable" deferred actions --> see MAddDeferredAction for more info
- //
- DefConst( 'kDA_StatusFrame,
- { fRunIt: true,
- fRanIt: nil,
- RanIt: func()
- fRanIt,
- KillIt: func()
- begin
- fRunIt := nil;
- fRanIt;
- end,
- } );
- DefConst( 'kDA_ActionFunc,
- func(fn, args, status)
- begin
- status.fRanIt := true;
- if status.fRunIt then
- Apply(fn, args);
- end );
- DefConst( 'kDA_AddDeferredAction,
- func(fn, args)
- begin
- local status := {_proto: kDA_StatusFrame};
- AddDeferredAction(kDA_ActionFunc, [fn, args, status]);
- status;
- end );
-